#!/bin/bash
rm -rdf bundle
mkdir bundle
mkdir bundle/Ajedrez.activity
cp *.py bundle/Ajedrez.activity/

mkdir bundle/Ajedrez.activity/engines
cp engines/gnuchess-linux bundle/Ajedrez.activity/engines/

mkdir bundle/Ajedrez.activity/data
cp -R data/* bundle/Ajedrez.activity/data/

mkdir bundle/Ajedrez.activity/activity
cp activity-icon.svg bundle/Ajedrez.activity/activity/
cd bundle

#Create activity.info
echo "[Activity]" > Ajedrez.activity/activity/activity.info
echo "name = Ajedrez" >> Ajedrez.activity/activity/activity.info
echo "service_name = org.x.ajedrezactivity" >> Ajedrez.activity/activity/activity.info
echo "activity_version = 1" >> Ajedrez.activity/activity/activity.info
echo "host_version = 1" >> Ajedrez.activity/activity/activity.info
echo "bundle_id = org.x.ajedrezactivity" >> Ajedrez.activity/activity/activity.info
echo "icon = activity-icon" >> Ajedrez.activity/activity/activity.info
echo "class = chessactivity.ChessActivity" >> Ajedrez.activity/activity/activity.info
echo "show_launcher = yes" >> Ajedrez.activity/activity/activity.info

#Create setup.py
echo "from sugar.activity import bundlebuilder" > Ajedrez.activity/setup.py
echo "if __name__ == \"__main__\":" >> Ajedrez.activity/setup.py
echo "	bundlebuilder.start(\"ajedrezactivity\")" >> Ajedrez.activity/setup.py

find Ajedrez.activity | grep -v MANIFEST | grep -v ".svn" > Ajedrez.activity/MANIFEST
rm -f ajedrez.xo
zip -rq ajedrez.xo Ajedrez.activity
#zip -dq ajedrez.xo "*.svn*"
cd ..
